
const vscode = require('vscode');


class UnitDataItem extends vscode.TreeItem {
    constructor(name, label, id, key, desc) {
        super(name + ':' + label, vscode.TreeItemCollapsibleState.None);
        this.id = id;
        this.key = key;
        this.name = name;
        this.desc = desc;
        this.command = {
            command: 'war3helper.UnitSet',
            title: 'war3helper.UnitSet',
            arguments: [this.name, this.id, this.key, this.desc]
        };
    }
}

class CheckItem extends vscode.TreeItem {
    constructor(name, checked, command) {
        super(name, vscode.TreeItemCollapsibleState.None);
        this.name = name;
        this.command = {
            command: command,
            title: command,
            arguments: [command]
        };
        this.toggleChecked(checked)
    }
    toggleChecked(bool) {
        this.checked = bool;
        if (bool == true) {
            this.iconPath = 'win.png';
        } else {
            this.iconPath = 'loss.png';
        }
    }
}

module.exports = {
    UnitDataItem,
    CheckItem,
}